package com.itheima.mapper;

import com.itheima.pojo.Emp;
import com.itheima.pojo.EmpQueryParam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {

    //左连接查询所有员工信息(在配置文件中书写sql语句)

    List<Emp> findAll(EmpQueryParam e);

    void insert(Emp emp);

    void deleteById(Integer id);

    Emp findById(Integer id);

    void update(Emp emp);

    @MapKey("pos")
    List<Map<String, Object>> getJobData();

    List<Map<String, Object>> getGenderData();

    List<Emp> list();

    @Select("select count(*) from emp where dept_id = #{id}")
    Integer getEmpCount(Integer id);

    @Select("select * from emp where username = #{username} && password = #{password}")
    Emp findByuserNameAndPassword(Emp emp);
}
